package cn.demo.pm.service.impl;

import java.util.List;
import com.mybatisflex.core.paginate.Page;
import cn.demo.common.core.page.PageQuery;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import cn.demo.pm.mapper.PmIntegralBillMapper;
import cn.demo.pm.domain.PmIntegralBill;
import cn.demo.pm.service.IPmIntegralBillService;

/**
 * 积分账单Service业务层处理
 *
 * @author xtjun
 * @date 2024-06-06
 */
@Service
public class PmIntegralBillServiceImpl extends ServiceImpl<PmIntegralBillMapper, PmIntegralBill> implements IPmIntegralBillService {
    @Resource
    private PmIntegralBillMapper pmIntegralBillMapper;
    /**
     * 查询积分账单
     *
     * @param id 积分账单主键
     * @return 积分账单
     */
    @Override
    public PmIntegralBill selectPmIntegralBillById(String id) {
        return pmIntegralBillMapper.selectOneById(id);
    }

    /**
     * 查询积分账单列表
     *
     * @param pmIntegralBill 积分账单
     * @return 积分账单
     */
    @Override
    public Page<PmIntegralBill> selectPmIntegralBillPage(PmIntegralBill pmIntegralBill, PageQuery pageQuery) {
        return pmIntegralBillMapper.paginate(pageQuery.build(), QueryWrapper.create(pmIntegralBill,PmIntegralBill.operators).orderBy(pageQuery.getOrderByColumn(),pageQuery.isAsc()));
    }
    @Override
    public List<PmIntegralBill> selectPmIntegralBillList(PmIntegralBill pmIntegralBill) {
        return pmIntegralBillMapper.selectListByQuery(QueryWrapper.create(pmIntegralBill,PmIntegralBill.operators));
    }

    /**
     * 新增积分账单
     *
     * @param pmIntegralBill 积分账单
     * @return 结果
     */
    @Override
    public int insertPmIntegralBill(PmIntegralBill pmIntegralBill) {
        return pmIntegralBillMapper.insert(pmIntegralBill);
    }

    /**
     * 修改积分账单
     *
     * @param pmIntegralBill 积分账单
     * @return 结果
     */
    @Override
    public int updatePmIntegralBill(PmIntegralBill pmIntegralBill) {
        return pmIntegralBillMapper.update(pmIntegralBill);
    }

    /**
     * 批量删除积分账单
     *
     * @param ids 需要删除的积分账单主键
     * @return 结果
     */
    @Override
    public int deletePmIntegralBillByIds(List<String> ids) {
        return pmIntegralBillMapper.deleteBatchByIds(ids);
    }

    /**
     * 删除积分账单信息
     *
     * @param id 积分账单主键
     * @return 结果
     */
    @Override
    public int deletePmIntegralBillById(String id) {
        return pmIntegralBillMapper.deleteById(id);
    }
}
